<template>
  <div class="easyd-weixin-Box">
    <div class="shopMenuBox">
      <div class="shopMenuItemBox">
        <div class="shopMenuItem" @click="goAddShop">
          <i class="fa fa-shopping-basket fa-lg"></i>新增商品
        </div>
      </div>
      <div class="shopMenuItemBox">
        <div class="shopMenuItem" @click="goInventoryManager">
          <i class="fa fa-server fa-lg"></i>库存管理
        </div>
      </div>
    </div>

    <div class="shopManagerBox">
      <mt-loadmore
        :top-method="loadTop"
        :bottom-method="loadBottom"
        :bottom-all-loaded="allLoaded"
        ref="loadmore"
      >
        <div class="shopManagerItem" v-for="i in 10">
          <div class="shopManagerItemInfo">
            <div class="shopManagerItemImage">
              <img :src="imageDemoUrl" v-lazy="imageDemoUrl" v-gallery>
            </div>
            <div class="shopManagerItemContent">
              <div class="shopManagerItemContentName">去屑洗发露780g止痒油男女洗发护发</div>
              <div class="shopManagerItemContentPriceAndBtn">
                <div class="shopManagerItemContentPrice">¥99.9</div>
                <div class="shopManagerItemContentBtn">
                  <span @click="goAddShop">编辑</span>
                  <span>删除</span>
                </div>
              </div>
            </div>
          </div>
          <div class="shopManagerMenuBox">
            <div class="shopManagerMenuItem" @click="goFocusShopUser">查看关注用户</div>
            <div class="shopManagerMenuItem" @click="goBrowseShopUser">查看浏览用户</div>
          </div>
        </div>
      </mt-loadmore>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      allLoaded: false,
      imageDemoUrl:
        "http://testfileupload.oss-cn-beijing.aliyuncs.com/shangpin1.jpg"
    };
  },
  methods: {
    goAddShop(){
        this.$router.push({
            path : '/addShop'
        })
    },
    goInventoryManager(){
      this.$router.push({
            path : '/inventoryManager'
        })
    },
    loadTop() {
      setTimeout(() => {
        this.$refs.loadmore.onTopLoaded();
      }, 2000);
    },
    loadBottom() {
      setTimeout(() => {
        this.allLoaded = true;
        this.$refs.loadmore.onBottomLoaded();
      }, 5000);
    },
    goFocusShopUser(){
      this.$router.push({
            path : '/focusShopUser'
        })
    },
    goBrowseShopUser(){
      this.$router.push({
            path : '/browseShopUser'
        })
    }
  }
};
</script>

<style lang="stylus" scoped>
@import '~PUBLIC_CSS'
.shopMenuBox {
  width: 100%;
  justify-content: space-between;
  height: 60px;
  display: flex;
  box-sizing: border-box;
  margin-top: 15px;
  padding-left: 15px;
  padding-right: 15px;

  .shopMenuItemBox {
    width: 48%;
    box-sizing: border-box;
    height: 60px;
    float: left;

    .shopMenuItem {
      width: 100%;
      height: 50px;
      text-align: center;
      line-height: 50px;
      $itemStyle()

      i {
        color: #999;
        font-size: 14px;
        position: relative;
        top: -2px;
        right: 10px;
      }
    }
  }
}

.shopManagerBox {
  width: 100%;
  top: 80px;
  position: absolute;
  bottom: 0px;
  box-sizing: border-box;
  padding-left: 15px;
  padding-top: 5px;
  padding-right: 15px;
  overflow: auto;
  -webkit-overflow-scrolling : touch;

  .shopManagerItem {
    width: 100%;
    height: auto; 
    box-sizing: border-box;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    $itemStyle()
    
  }

  .shopManagerItemInfo {
    width: 100%;
    height: 80px;
    display: flex;
  }

  .shopManagerItemImage {
    width: 100px;
    height: 80px;
    margin-right: 10px;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 5px;
    }
  }

  .shopManagerItemContent {
    flex: 1;
    position: relative;
  }

  .shopManagerItemContentName {
    width: 100%;
    height: 40px;
    font-weight: 500;
    text-align: justify;
  }

  .shopManagerItemContentPriceAndBtn {
    width: 100%;
    height: auto;
    position: absolute;
    bottom: 0px;
  }

  .shopManagerItemContentPrice {
    width: 80px;
    height: 30px;
    float: left;
    letter-spacing: 1px;
    font-weight: 500;
    font-size: 16px;
    line-height: 40px;
    color: orange;
  }

  .shopManagerItemContentBtn {
    width: auto;
    height: 25px;
    float: right;
    text-align: center;
    line-height: 25px;
    margin-top: 5px;
    color: #666;
    font-size: 14px;

    span {
      width: 50px;
      float: left;
    }
  }

  .shopManagerItemDesc {
    width: 100%;
    height: auto;
    line-height: 22px;
    font-size: 12px;
    margin-top: 10px;
    text-align: justify;
  }

  .shopManagerMenuBox {
    width: 100%;
    display: flex;
    justify-content: space-between;

    .shopManagerMenuItem {
      width: 48%;
      height: 45px;
      background: #FDDE6E;
      line-height: 45px;
      text-align: center;
      margin-top: 5px;
      color: #666;
      font-weight: 500;
      margin-top: 10px;
      border-radius: 5px;
    }
  }
}
</style>

